package com.zsummer.zero.hibernate;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtils {
	
	private HibernateUtils() {};
	
	private static Configuration configure;
	private static SessionFactory sessionFactory;
	
	static {
		configure = new Configuration().configure();
		sessionFactory = configure.buildSessionFactory();
	}
	
	public static Session openSession() {
		return sessionFactory.openSession();
	}
	
	public static SessionFactory getsessionFactory() {
		return sessionFactory;
	}
	
	public static void close() {
		sessionFactory.close();
	}

}
